sudo yum -y install epel-release
sudo yum -y update

wget https://packages.erlang-solutions.com/erlang/rpm/centos/7/x86_64/esl-erlang_22.2.1-1~centos~7_amd64.rpm -c
sudo yum -y install  socat logrotate esl-erlang_22.2.1-1~centos~7_amd64.rpm

wget https://github.com/rabbitmq/rabbitmq-server/releases/download/v3.7.9/rabbitmq-server-3.7.9-1.el7.noarch.rpm
sudo rpm --import https://www.rabbitmq.com/rabbitmq-signing-key-public.asc
sudo rpm -Uvh rabbitmq-server-3.7.9-1.el7.noarch.rpm

sudo systemctl start rabbitmq-server

sudo rabbitmq-plugins enable rabbitmq_management
sudo chown -R rabbitmq:rabbitmq /var/lib/rabbitmq/
sudo rabbitmqctl add_user g1 admin
sudo rabbitmqctl set_user_tags g1 administrator
sudo rabbitmqctl set_permissions -p / g1 ".*" ".*" ".*"

# http://Your_Server_IP:15672

# docker
# docker run -d --hostname r1 --name r1 -p 15672:15672 -p 5762:5672 rabbitmq:3-management
# docker run -d --hostname r1 --name r1 -p 15672:15672 -p 5672:5672 -p 5671:5671 -e RABBITMQ_DEFAULT_USER=g1 -e RABBITMQ_DEFAULT_PASS=admin rabbitmq:3.9.12-management
# docker run -d --hostname r1 --name r1 -p 15672:15672 -p 5672:5672 -p 8571:5671 -v /data/xuke/rabbit\@r1:/var/lib/rabbitmq/mnesia/rabbit@r1  -e RABBITMQ_DEFAULT_USER=g1 -e RABBITMQ_DEFAULT_PASS=admin rabbitmq:3.9.12-management
# wget https://github.com/rabbitmq/rabbitmq-delayed-message-exchange/releases/download/3.9.0/rabbitmq_delayed_message_exchange-3.9.0.ez
# docker cp rabbitmq_delayed_message_exchange-3.9.0.ez r1:/opt/rabbitmq/plugins
# docker exec r1 rabbitmq-plugins enable rabbitmq_delayed_message_exchange
